<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:cc="http://java.sun.com/jsf/composite/componentes">   

 	<body> 
 	  	<ui:composition template="../resources/templates/tempCadForm.xhtml">     
     	 	
            <!--CABEÇALHO-->
     	 	<ui:define name="topoCad">  
     	 	   
				<!--COMPONENTE - TITULO -->
			    <cc:compTitulo  formTitulo="Dados do Perfil"  
			                    formUrlImg="#{imageBean.imgPerfil}" />  
    		</ui:define>  
    		
    		<!--CORPO-->
     	 	<ui:define name="corpoCad"> 
     	 	
         		<!-- FORMULÁRIO PRINCIPAL -->
         		<h:form id="formDados">
         		  <div> 
         		  
         		     <!-- NOME PERFIL --> 
         		     <div>
	                    <h:outputLabel for="idNome" value="Nome *" styleClass="label-titulo-1" />
	                 </div>
	                 <div>   
	                    <p:inputText value="#{perfilBean.perfil.nome}"
	                                 size="60" 
	                                 maxlength="60"/>
         		     </div> 
         		     
         		     <!-- CONFIRMAÇÃO DE EXCLUSAO -->
         		     <cc:compConfirmDialog/>
         		     
         		    <!--MESSAGES -->
                     <p:growl id="growl" showDetail="true" escape="false" autoUpdate="true" life="#{applicationBean.timeGrowl}"/> 
         		     
         		     <div class="div-espaco-2"/>  
         		     
	         	     <div>
	         	        
	         	        <!--MENU-->
	         	        <p:dataList value="#{menuBean.listMenuPerfil}" var="menu">
		                     <p:column>
						         <div>
						         
						             <div>
							             <h:outputLabel value="#{menu.nome}" styleClass="label-titulo-1"  />
						             </div>
						           
						             <div class="div-h-linha" style="width: 30%"/>
						             <div class="div-espaco-3"/>
						             
						             <!--ITENS DO MENU-->
						             <div style="padding-left: 3px">
							             <p:dataList value="#{menu.listMenuItem}" var="menuItem">
							                  
							                   <!-- MENUS NÃO TRANSACIONAIS -->        
							                   <div style="#{not menuItem.transacional ? 'display : block' : 'display : none' }">
									                 <table style="padding-left: 8px" cellspacing="5px">
							                           <tr>
							                             <td>
							                                <p:selectBooleanCheckbox value="#{menuItem.visivelNaoTransacional}" />
							                             </td>
							                             
							                             <td>
							                                <h:outputLabel value="#{menuItem.nome}" />
							                                
							                             </td>
							                           </tr>
							                         </table>
							                         <div class="div-espaco-2"/>
									           </div>		
																                  
							                   <!-- MENUS TRANSACIONAIS -->   
							                   <div style="#{menuItem.transacional? 'display : block' : 'display : none' };
							                         padding-left: 10px">   
								                  
								                   <div>
								                     <h:outputLabel value="#{menuItem.nome}" styleClass="label-cinza"   />
								                   </div>
								                         
								                   <div class="div-espaco-1"/>
								                   
								                   <table style="padding-left: 10px" cellspacing="5px">
								                     <tr>
								                      
								                       <!--INSERIR -->
								                       <td>
								                         <h:outputLabel value="Incluir"   />
								                       </td>
								                       <td>
								                         <p:selectBooleanCheckbox value="#{menuItem.incluir}" />
								                       </td>
								                       
								                       <!--ALTERAR -->
								                       <td>
								                         <h:outputLabel value="Alterar"   />
								                       </td>
								                       <td>
								                         <p:selectBooleanCheckbox value="#{menuItem.alterar}" />
								                       </td>
								                       
								                       <!--EXCLUIR -->
								                       <td>
								                         <h:outputLabel value="Excluir"   />
								                       </td>
								                       <td>
								                         <p:selectBooleanCheckbox value="#{menuItem.excluir}" />
								                       </td>
								                       
								                        <!--EXCLUIR -->
								                       <td>
								                         <h:outputLabel value="Visível"   />
								                       </td>
								                       <td>
								                         <p:selectBooleanCheckbox value="#{menuItem.visivel}" />
								                       </td>
								                     </tr>
								                   </table>
								                   <div class="div-espaco-2"/>
								                </div>
								                
							             </p:dataList>
						             </div>
						             
						             <div class="div-espaco-3"/>
						         </div>
		                     </p:column>
		          	    </p:dataList>	  
	         	     
	         	     </div>	 
	         		 
					 <div>
					 
					      <h:panelGrid columns="3" columnClasses="label, value" >
					      
					     		 <p:commandButton id="idBtnSalvar" 
	                                                value="#{msg['btn-value-salvar']}"
	                                                update="formDados" 
	                                                styleClass="ui-priority-primary"
                                         			action="#{perfilBean.salvar}" 
                                         			style="width:100%"
                                         			ajax="false"/>
                                         			
                                   <p:commandButton id="idBtnExcluir" 
                          				   value="#{msg['btn-value-excluir']}"
                          				   rendered="#{perfilBean.isEditRecord ? (usuarioBean.permissaoAlterar() ? 
                          				   										  !perfilBean.perfil.fixo : false) :false}"
 										   update="formDados" 
                                   		   actionListener="#{perfilBean.excluir}" style="width:100%"> 
                                   		   
                                   		   <p:confirm header="Confirmação" message="#{msg['dlg-msg-body']}"  
					                                   icon="ui-icon-alert" />
                                   		   </p:commandButton>
	                                <p:commandButton id="idBtnVoltar" 
	                                
	                                                value="#{msg['btn-value-cancelar']}" 
	                                                action="#{perfilBean.voltar}" 
	                                                immediate="true" />
	         		      </h:panelGrid>  
	                      
					 </div>				
	              </div> 
         		</h:form>  		  
    		</ui:define>  
    	 </ui:composition> 
  	</body> 
</html>



